<?php
    $this->title = "Eventi";
    $this->headTitle($this->title);
?>
<?php
    $allDisco   = $this->allDisco;
    $zonaList   = $this->zonaList;
    $discoName  = $this->discoName;
    $feste      = $this->feste;
    $eventiData = $this->eventiData;
?>
<?php
/**
 *  dispay all disco in  sponsor0
 */
$line = '<div id="box">';
foreach ($allDisco as $key=>$allDisco2){
    $line_new = '<h2><a href="'. $this->url(array('controller'=>'Club',
                                                  'name'=> $allDisco2[0],
                                                   ), 'locale', TRUE) .'">' . $allDisco2[1]
              . '</a></h2>';
    $line = $line . $line_new;
    }
$line = $line . '</div>';
$this->layout()->sponsor0 = $line;

/**
 * dispay all "provincia" in  provincia
 */
$line4 = '';
foreach ($zonaList as $key=>$zonaList2){
    $line4_new = '<h2><a href="'. $this->url(array('controller'=>'Index',
                                                    'action'=>'provincia',
                                                    'id'=> $zonaList2,
                                                   ), 'index', TRUE) .'">' . $zonaList2 . '</a></h2>';
    $line4 = $line4 . $line4_new;
    }
$line4 = $line4 . '';
$this->layout()->provincia = $line4;
?>
<h3>Eventi di Capodanno</h3>
<p id="catpicker">
    <a href="<?php $this->url(array('controller'=>'Index',
                                 'action'=>'eventi',
                                 'id'=>'noid'),
                                 'index', true);?>" id="allcat" class="current">TUTTI</a> |
    <?php
        foreach ($discoName as $key=>$discoName2){
            echo '<a href="#" id="'. str_replace(" ", "", trim($discoName2)) .'" class="filter">'. $discoName2 . '</a> | ';
        }
    ?>
</p>
<?php
    require_once "models/Db/Event_db.php";
    require_once "models/Utility/Utility.php";

    $utility_obj = new Utility();
    $eventHandle = new Event_db();

    foreach ($eventiData as $discoElement){

        //usa event_db per recuperare il nome
        $piva = $discoElement['piva'];
        $id_evento = $discoElement['id'];

        $discoName3 = $eventHandle->getNameDsicoByPiva($piva);
        $thumb = $eventHandle->getThumbByID($id_evento);
        $thumb_path = $thumb['thumb_path'];
        $titolo_evento = $discoElement['titolo'];
        $html_descrizione = html_entity_decode($discoElement['descrizione']);
        $descrizione = $utility_obj->trim_body(strip_tags($html_descrizione), 100);
        $data = $discoElement['data_inizio'];
?>
<a id="discount-item_a"href="#" >
    <div class="discounted-item <?php
                                echo str_replace(" ", "", trim($discoName3['name'])) ?>" rel="<?php
                                echo $this->url(array(
                                    'controller'=>'Index',
                                    'action'=>'evento',
                                    'id'=>"0_" . $id_evento), 'index', TRUE);
         ?>">
        <img src="/<?php echo $thumb_path ?>" alt="flayer" />
        <div class="reasonbar">
            <div class="prod-title" style="width: 65%;"><?php echo $titolo_evento ?></div>
            <div class="reason" style="width: 29%;"><span class="dname"><?=$discoName3['name']?></span> <?=$data?></div>
        </div>
        <div class="discount-bar">
            <?php echo $descrizione; ?>
        </div>
    </div>
</a>
<?php
    }
?>